<?php 
  class OrederModel extends Model{
  	public $table = 'order';





  	public function get_data($where = NULL){
  		return $this->all($where);
  	}

  	public function get_one_data($where=NULL){
  		return $this->where($where)->find();
  	}


  	public function add_data($data=NULL){
  		
  		$stid = Q('get.stid',0,'intval');

  		$oid =  $this->add($data);

  		$defaultGetall = $_SESSION['shop'][$stid]['goods'];
  		foreach ($defaultGetall as $key => $value) {
  			$shop_oreder =array(
  				'oid' => $oid,
  				'total' =>$value['total'],
  				'number'=>$value['num'],
  				'shopname'=>$value['name']

  				);
  			K('ShopOreder')->add_data($shop_oreder);
  		}

  		


  		return true;
  	}


  }





 ?>